/**
 * 
 */
package com.fly.sms.adapter;

import java.util.List;
import java.util.Map;

import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.widget.TextView;

import com.fly.sms.CommonActivity;
import com.fly.sms.R;

public class PublicNoticeListAdapter extends IAdapter {
	private List<Map<String, Object>> publicNoticeList=null;

	public PublicNoticeListAdapter(CommonActivity context,List<Map<String, Object>> publicNoticeList) {
		super(context);
		this.publicNoticeList=publicNoticeList;
	}

	public int getCount() {
		return  publicNoticeList.size();
	}

	public Object getItem(int position) {
		return position;
	}

	public long getItemId(int position) {
		return position;
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		if(convertView==null){
			convertView=context.getView(R.layout.publicnoticeitem);
		}
		Map<String, Object> publicNotice=publicNoticeList.get(position);
		TextView publicNoticeTopic=(TextView)convertView.findViewById(R.id.publicNoticeTopic);
		TextView publicNoticeTime=(TextView)convertView.findViewById(R.id.publicNoticeTime);
		WebView publicNoticeBody=(WebView) convertView.findViewById(R.id.publicNoticeBody);
		publicNoticeTopic.setText(publicNotice.get("Topic").toString());
		publicNoticeTime.setText(publicNotice.get("UpdateTime").toString());
		publicNoticeBody.loadDataWithBaseURL("", publicNotice.get("Body")
				.toString(), "text/html", "utf-8", null);
		//publicNoticeBody.set
		//publicNoticeBody.setBackgroundColor(R.color.greenbackground);
		return convertView;
	}
}
